package com.wh.usercenter3.response;

import com.wh.usercenter3.constant.Code;
import com.wh.usercenter3.constant.CodeConstant;

/**
 * 统一返回工具类
 */
public class ResultUtil {

    public static Result ok() {
        return new Result<>(CodeConstant.OK,null);
    }

    public static <T> Result<T> ok(T data) {
        return new Result<>(CodeConstant.OK, data);
    }

    public static Result err(CodeConstant codeConstant) {
        return new Result<>(codeConstant, null);
    }

    public static Result err(CodeConstant codeConstant, String message) {
        return new Result(codeConstant.getCode(), codeConstant.getMessage() + " - " + message, null);
    }
}
